#include <iostream>
using namespace std;
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch>'9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); }
    return x * f;
}

/**
 * https://www.luogu.com.cn/problem/P1085
 */
int main() {
    int max = -1;
    int week = -1;
    for (int i = 1; i <= 7; i++) {
        int a = read();
        int b = read();

        int sum = a + b;
        if (sum > max) {
            max = sum;
            week = i;
        }
    }
    if (max <= 8) {
        cout << 0;
    }
    else {
        cout << week;
    }
    return 0;
}